import json

import requests


class PageAnalyse:
    def getAppPages(self):
        url = "http://192.168.1.224/triton/sephora/report/getAppPages"
        header = {"Content-Type": "application/json;charset=UTF-8"}
        data = {"params":{"appName":"com.rongyi.sflcustomized"}}
        r = requests.post(url, data=json.dumps(data), headers=header)
        print('页面名称', r.json())
        return r.json()

    def getAppEvents(self):
        url = "http://192.168.1.224/triton/sephora/report/getAppEvents"
        header = {"Content-Type": "application/json;charset=UTF-8"}
        data = {"params":{"appName":"com.rongyi.sflcustomized","pageEngNames":["PAGE_INDEX"]}}
        r = requests.post(url, data=json.dumps(data), headers=header)
        print('事件名称', r.json())
        return r.json()

    def getShopPageVisits(self):
        url = "http://192.168.1.224/triton/sephora/report/getShopPageVisits"
        header = {"Content-Type": "application/json;charset=UTF-8"}
        data = {"params":{"appName":"com.rongyi.sflcustomized","startDate":"2020-09-16","endDate":"2020-09-21","pageEngName":"PAGE_INDEX","pageEventEngNames":["E_BT_ALL_BRAND","E_ICON_HOT_TOPIC","E_BT_SHOPPING","E_TXT_HOT_TOPIC"],"shopId":[14,11,6,1],"sephoraTerminalId":[3,5,14,21],"current":1,"size":50}}
        r = requests.post(url, data=json.dumps(data), headers=header)
        print('页面分析分页', r.json())
        return r.json()


    def getPageVisitsLine(self):
        url = "http://192.168.1.224/triton/sephora/report/getPageVisitsLine"
        header = {"Content-Type": "application/json;charset=UTF-8"}
        data= {"params":{"appName":"com.rongyi.sflcustomized","startDate":"2020-09-16","endDate":"2020-09-21","pageEngName":"PAGE_INDEX","pageEventEngNames":["E_BT_ALL_BRAND","E_ICON_HOT_TOPIC","E_BT_SHOPPING","E_TXT_HOT_TOPIC"],"shopId":[14,11,6,1],"sephoraTerminalId":[3,5,14,21],"current":1,"size":10}}
        r = requests.post(url, data=json.dumps(data), headers=header)
        print('页面分析趋势', r.json())
        return r.json()

    def getPageElementClick(self):
        url = "http://192.168.1.224/triton/sephora/report/getPageElementClick"
        header = {"Content-Type": "application/json;charset=UTF-8"}
        data={"params":{"appName":"com.rongyi.sflcustomized","startDate":"2020-09-16","endDate":"2020-09-21","pageEngName":"PAGE_INDEX","pageEventEngNames":["E_BT_ALL_BRAND","E_ICON_HOT_TOPIC","E_BT_SHOPPING","E_TXT_HOT_TOPIC"],"shopId":[14,11,6,1],"sephoraTerminalId":[3,5,14,21],"pageElementEngName":"E_TXT_HOT_TOPIC","current":1,"size":50}}
        r = requests.post(url, data=json.dumps(data), headers=header)
        print('元素点击趋势', r.json())
        return r.json()

    def getPageTendency(self):
        url = "http://192.168.1.224/triton/sephora/report/getPageTendency"
        header = {"Content-Type": "application/json;charset=UTF-8"}
        data= {"params":{"shopId":[1],"sephoraTerminalId":[5],"pageEngName":"PAGE_INDEX","startDate":"2020-09-16","endDate":"2020-09-21"}}
        r = requests.post(url, data=json.dumps(data), headers=header)
        print('页面点击占比', r.json())
        return r.json()

    def getPageClicks(self):
        url = "http://192.168.1.224/triton/sephora/report/getPageClicks"
        header = {"Content-Type": "application/json;charset=UTF-8"}
        data= {"params":{"shopId":[1],"sephoraTerminalId":[5],"pageEngName":"PAGE_INDEX","startDate":"2020-09-16","endDate":"2020-09-21"}}
        r = requests.post(url, data=json.dumps(data), headers=header)
        print('页面点击次数', r.json())
        return r.json()

    def getPageElementRatio(self):
        url = "http://192.168.1.224/triton/sephora/report/getPageElementRatio"
        header = {"Content-Type": "application/json;charset=UTF-8"}
        data={"params":{"shopId":[1],"sephoraTerminalId":[5],"pageEngName":"PAGE_INDEX","startDate":"2020-09-16","endDate":"2020-09-21"}}
        r = requests.post(url, data=json.dumps(data), headers=header)
        print('元素点击占比列表', r.json())
        return r.json()





#a=PageAnalyse()
#a.getPageElementRatio()